class Solution:
    def maximumTime(self, time: str) -> str:
        time = list(time)

        if time[0] == '?':
            if time[1] in ['?', '0', '1', '2', '3']:
                time[0] = '2'
            else:
                time[0] = '1'

        if time[1] == '?':
            if time[0] == '2':
                time[1] = '3'
            else:
                time[1] = '9'

        if time[3] == '?':
            time[3] = '5'

        if time[4] == '?':
            time[4] = '9'

        return ''.join(time)


sl = Solution()
time = "2?:?0"
time = "0?:3?"
time = "1?:22"
print(sl.maximumTime(time))
